<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <a href="javascript:void(0);" title="/img/1.png">图片一</a><br />
    <a href="javascript:void(0);" title="/img/2.png">图片二</a><br />
    <a href="javascript:void(0);" title="/img/3.png">图片三</a><br />
    <a href="javascript:void(0);" title="/img/4.png">图片四</a>
    <p>----------------------------</p>
    <img src="img/blank.png" alt="blank"/>
    <script type="text/javascript">
        var a = document.getElementsByTagName('a');
        for (var i = 0; i < a.length; i++) {
            a[i].onclick = function () {
                showPic(this); 
            }
        }
            function showPic(whichpic) {
            var source = whichpic.getAttribute('title'); //获取目标元素的title属性;
            var placeholder = document.getElementsByTagName('img')[0]; //获取占位符图片对象;
            placeholder.setAttribute('src', source); //图片替换
        }
    </script>
</body>
</html>